﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using com.codeplex.eatoutadvocate.Web.Mvc.Models;

namespace com.codeplex.eatoutadvocate.Web.Mvc.Engine
{
    public class Recommendation //: IComparable
    {
        public static List<string> Recommend(List<EatOut> eatOutData)
        {
            return Recommend(eatOutData, 3); // return 3 restaurants by default
        }

        // Count = how many restaurants to recommend
        public static List<string> Recommend(List<EatOut> eatOutData, int count)
        {
            if (count > eatOutData.Count) { return null; }

            List<string> restaurants = new List<string>();
            IComparer<EatOut> rank = new RankDescending();
            eatOutData.Sort(rank);
            for (int i = 0; i < count; i++)
            {
                restaurants.Add(eatOutData[i].Restaurant.Name);
            }
            return restaurants;
        }
    }
}
